<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function deepCopy(obj) {
            var o ={};
            for(var k in obj){
                o[k] = (typeof obj[k] === 'object') ? deepCopy(obj[k]) : obj[k];
            }
            return o;
        }
        var p1 = {name:'Jim',subject:{name:['HTML','CSS']}};
        var p2 = deepCopy(p1);
        p2.subject.name[0] = 'javascript';
        console.log(p1.subject.name[0]);
        console.log(p2.subject.name[0]);
        console.log(p1===p2);
    </script>
</body>
</html>